#include<cstdio>
int T,o,n,z,a[1000005],b[1000005],c[1000005],d[1000005],f[1000005],g[1000005],h[1000005];
int ss(int x,int y){
	if(y-x<n)return 1;
//	printf("%d %d %d %d %d %d %d %d %d %d\n",x,y,a[x],a[y],b[x],b[y],d[b[x]+1],d[b[x]-1],d[b[y]+1],d[b[y]-1]);
	if((d[b[x]+1]==1&&b[x]+1<=2*n||d[b[x]-1]==1&&b[x]-1>=1)&&f[a[x]]==0){
		f[a[x]]=1;d[b[x]]=1;
		if(ss(x+1,y)){
			g[o]=a[x];h[o]=0;o--;
//			printf("%d %d %d\n",x,y,n*2-o);
			if(d[b[x]+1]==1)h[n*2-o]=0;
			else if(d[b[x]-1]==1)h[n*2-o]=1;
			d[b[x]]=0;f[a[x]]=0;
			return 1;
		}
		d[b[x]]=0;f[a[x]]=0;
	}
	if((d[b[y]+1]==1&&b[y]+1<=2*n||d[b[y]-1]==1&&b[y]-1>=1)&&f[a[y]]==0){
		f[a[y]]=1;d[b[y]]=1;
		if(ss(x,y-1)){
			g[o]=a[y];h[o]=1;o--;
//			printf("%d %d %d\n",x,y,n*2-o);
			if(d[b[y]+1]==1)h[n*2-o]=0;
			if(d[b[y]-1]==1)h[n*2-o]=1;
			d[b[y]]=0;f[a[y]]=0;
			return 1;
		}
		d[b[y]]=0;f[a[y]]=0;
	}
	return 0;
}
int main(){
	freopen("palin.in","r",stdin);
	freopen("palin.out","w",stdout);
	scanf("%d",&T);
	while(T--){
		scanf("%d",&n);z=0;o=n;
		for(int i=1;i<=2*n;i++){
			scanf("%d",&a[i]);
			if(c[a[i]]==0)c[a[i]]=i;
			else{b[c[a[i]]]=i;b[i]=c[a[i]];c[a[i]]=0;}
		}
//		for(int i=1;i<=2*n;i++)printf("%d ",b[i]);printf("\n");
		d[b[1]]=1;f[a[1]]=1;z=ss(2,2*n);d[b[1]]=0;f[a[1]]=0;g[1]=a[1];h[1]=0;h[2*n]=0;
		if(z==0){d[b[2*n]]=1;f[a[2*n]]=1;z=ss(1,2*n-1);d[b[2*n]]=0;f[a[2*n]]=0;g[1]=a[1];h[1]=1;h[2*n]=0;}
		if(z==0)printf("-1\n");
		else {for(int i=1;i<=2*n;i++)printf("%c",h[i]==0?'L':'R');printf("\n");}
	}
}
